<?php session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
//  Copyright (C) 2004-2006  Autodesk, Inc.
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of version 2.1 of the GNU Lesser
//  General Public License as published by the Free Software Foundation.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-->
<html>
	<!-- Open an empty task pane and display it while we wait for 
	 the map to be initialized, thus preventing the user 
	 from executing commmands before the map is ready. 
	 Doing so would generate errors.
	 When the map is initialized, open 'task_pane2.php'.
-->
	<head>
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
		<title>Task Pane</title>
		<meta http-equiv="content-style-type" content="text/css">
		<link href="../styles/globalStyles.css" rel="stylesheet" type="text/css">
		<link href="../styles/otherStyles.css" rel="stylesheet" type="text/css">
		<link href="/mapguide/viewerfiles/viewer.css" rel="stylesheet" type="text/css">
		<meta http-equiv="content-script-type" content="text/javascript">
		<?php
		    if (isset($_SESSION['cliente']))
    		{
			// Get the parameters that were passed in with the URL.
			// We will pass them on to the second task pane.
			$parameters =  "";
			$array =  ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST: $_GET;
			foreach ($array as $key => $value)
			{
				$parameters .= "$key=$value&";
			}	
		?>
	<script language="javascript" type="text/javascript">
			function OnPageLoad()
			{			
				var initTimer = setInterval(waitForMap, 200);
				
				// Wait for the map to be initialized.
				// When it is, open the second task pane.
				function waitForMap () 
				{
					try 
					{
						// The Refresh method will exist when the
						// map has been initialized.
						if (parent.parent.mapFrame.Refresh) 
						{
							clearInterval(initTimer);
							// Open the second task pane
							window.location = "task_pane2.php?<?= $parameters ?>";
						}
					}
					catch(Exception) {}
				}				
			}
		</script>
	</head>
	<body class="AppFrame" onload="OnPageLoad()">
		<!-- This is an empty task pane, displayed while we wait for the map to be
		 initialized.
		-->
	</body>
	<?}
		else 
		{
  			echo "<font class=Errors> Debe iniciar session para poder visualizar esta pagina.</font>";
		}
  

?>
</html>
